﻿using FileEntity = MicroCloud.Systems.Entities.File;

namespace MicroCloud.Api.Systems.Areas.Admin.Controllers
{
    /// <summary>
    /// 字典信息
    /// </summary>
    [Description("文件信息")]
    [ModuleInfo(Code = "File", Name = "文件信息", OrderNo = 1, Position = "Systems", PositionName = "系统管理模块")]
    public partial class FileController : AdminApiControllerBase
    {
        protected IFileStore<FileEntity> FileStore => ServiceProvider.GetService<IFileStore<FileEntity>>();

        /// <summary>
        /// 读取文件列表信息
        /// </summary>
        [HttpPost]
        [Description("读取")]
        [ModuleInfo]
        public PageData<FileOutputDto> Read(PageRequest request)
        {
            Check.NotNull(request, nameof(request));
            IFunction function = this.GetExecuteFunction();

            Expression<Func<FileEntity, bool>> predicate = FilterService.GetExpression<FileEntity>(request.FilterGroup);
            var page = CacheService.ToPageCache<FileEntity, FileOutputDto>(FileStore.Files, predicate, request.PageCondition, function);

            return page.ToPageData();
        }



    }
}